from dingtalkchatbot.chatbot import DingtalkChatbot

# 定义钉钉发送通知
def send(message):
    # 引用setting里面配置的钉钉群消息通知webhook地址
    #webhook = settings.DINGTALK_WEB_HOOK
    # 此链接需要在钉钉创建一个内部群；生成的连接
    webhook = "https://oapi.dingtalk.com/robot/send?access_token=8ef351502e0da9b1cd0320a0ae0b60a92644e94cc68a7c267c0504f1039e3069"
    # 初始化机器人小丁
    xiaoding = DingtalkChatbot(webhook)

    # text消息@所有人
    xiaoding.send_text(msg=('设备通知:%s'% message))